// AuthResponse.java
package com.gj.tourismcommunity.dto;

import lombok.Data;

@Data
public class AuthResponse {
    private boolean success;
    private String message;
    private String token;
    private UserInfo user;
    
/**
 * 构造函数：创建一个AuthResponse实例
 * @param success 表示认证是否成功的布尔值
 * @param message 认证结果的相关信息描述
 */
    public AuthResponse(boolean success, String message) {
    // 初始化success属性，传入的success参数赋值给对象的success属性
        this.success = success;
    // 初始化message属性，传入的message参数赋值给对象的message属性
        this.message = message;
    }
    
    public AuthResponse(boolean success, String message, String token, UserInfo user) {
        this.success = success;
        this.message = message;
        this.token = token;
        this.user = user;
    }
    
    @Data
    public static class UserInfo {
        private Long id;
        private String username;
        private String email;
        private String avatar;
        private String role;
        
        public UserInfo(Long id, String username, String email, String avatar, String role) {
            this.id = id;
            this.username = username;
            this.email = email;
            this.avatar = avatar;
            this.role = role;
        }
    }
}